﻿using JamesZhao.Engine.Graphics;
using SlimDX.Windows;

namespace JamesZhao.Engine
{
    public class GameEngine
    {
        public GameEngine()
        {
            ConfigManager = new ConfigManager();
            GraphicsManager = new GraphicsManager(this);
            InputManager = new InputManager(this);
            SceneManager = new SceneManager(this);
        }

        public InputManager InputManager { get; private set; }
        public GraphicsManager GraphicsManager { get; private set; }
        public ConfigManager ConfigManager { get; private set; }
        public SceneManager SceneManager { get; private set; }

        public void Initialize()
        {
            GraphicsManager.Initialize();
            InputManager.Initialize();
        }

        public void Step()
        {
            InputManager.Update();
            SceneManager.Update();
            GraphicsManager.Update();
        }

        public void Run()
        {
            MessagePump.Run(GraphicsManager.MainViewport.Form, Step);
        }
    }
}